package LC;

/**
 * @ClassName LC11
 * @Description: TODO
 * @Author hl
 * @Date 2021/3/26
 * @Version V1.0
 **/
public class LC11 {
    public static int maxArea(int[] height) {
        int i=0;
        int j=height.length-1;
        int res=0;
        while(i<j){
            res=height[i]<height[j]?Math.max(res,(j-i)*height[i++]):Math.max(res,(j-i)*height[j--]);
        }
        return res;
    }

    public static void main(String[] args) {
        int []height = {4,3,2,1,4};
        System.out.println(maxArea(height));
    }
}
